﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin1_Surcharge : System.Web.UI.Page
{
    eStoreDataContext db = new eStoreDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {
        rpt_flash.DataSource = db.Surcharges;
        rpt_flash.DataBind();
    }
  
    protected void lbt_ClosEdit_Click(object sender, EventArgs e)
    {
        panel_Edit.Visible = false;
    }
    protected void btn_Save_Edit_Click(object sender, EventArgs e)
    {
        var sur = db.Surcharges.Single(c => c.SurchargeId == int.Parse(txt_SurchargeId_Edit.Text));
        sur.Singleroom = int.Parse(txt_Singleroom_Edit.Text);
        sur.Foreigner = int.Parse(txt_Foreigner_Edit.Text);
        db.SubmitChanges();
        Response.Redirect("Surcharge.aspx");
    }
    protected void lbt_ChinhSua_Click(object sender, EventArgs e)
    {
        int surid = int.Parse(((LinkButton)sender).CommandArgument.ToString());
        var sur = db.Surcharges.Single(c => c.SurchargeId == surid);
        txt_SurchargeId_Edit.Text = surid.ToString();
        txt_Foreigner_Edit.Text = sur.Foreigner.ToString();
        txt_Singleroom_Edit.Text = sur.Singleroom.ToString();
        var tou = db.Tours.Single(c => c.TourId == sur.TourId);
        txt_TourId.Text = tou.NameVN;
    }
}